package vn.com.vega.music.objects;

public class WrapObjectDownload {
	private Song song;
	private Video video;
	public WrapObjectDownload(Object object) {
		if (object instanceof Song) {
			song = (Song) object;
		} else if (object instanceof Video) {
			video = (Video) object;
		}
	}
	
	public String getTitle() {
		if (song != null) {
			return song.title;
		} else if (video != null) {
			return video.title;
		}
		return "";
	}
	
	public int getId() {
		if (song != null) {
			return song.id;
		} else if (video != null) {
			return Integer.valueOf(video.id).intValue();
		}
		return -1;
	}
	
	public boolean isVideo() {
		return video != null;
	}
	
	public boolean isSong() {
		return song != null;
	}
	
	public Object getRealObject() {
		if (song != null){
			return song;
		} else if (video != null) {
			return video;
		}
		return null;
	}
	
	public String getObjectName() {
		if (isSong()) {
			return "bài hát";
		} else if (isVideo()) {
			return "video"; 
		}
		return "";
	}
	
	public boolean compare(Song song) {
		if (song == null) {
			return false;
		}
		if (song.id == this.song.id) {
			return true;
		}
		return false;
	}
	
	public boolean compare(Video video) {
		if (video == null) {
			return false;
		}
		if (video.id == this.video.id) {
			return true;
		}
		return false;
	}
}
